<template>
  <div>
    <div>
      <div class="headTitle">转介绍客户</div>
      <FilterTable
        ref="introTable"
        :columns="introColumns"
        :fetchapi="referralsApi"
        :params="referralsParams"
        :datakey="'records'"
        :isColumnFilter=false
        :isToperInfo=false
        :isSelectColumn=false
        :onColumnsChange="columns => this.columns = columns"
        :height=200
      />
      <!-- <div class="headTitle">重复线索</div>
      <FilterTable
        ref="repeatTable"
        :columns="repeatColumns"
        :fetchapi="fetchApi"
        :params="fetchParams"
        :datakey="'records'"
        :isColumnFilter=false
        :isToperInfo=false
        :isSelectColumn=false
        :onColumnsChange="columns => this.columns = columns"
        :height=200
      /> -->
    </div>

  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import { formatdate } from '@/utils/index';
import {
  queryReferralsCustomers
} from '@/api/customerCare/saleVisit/downfeedback';

export default {
  name: 'DownfeedbackLink',
  mixins: [dictionary],
  props: {
    rowData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      referralsParams: {"id":this.rowData.customerBusinessId},
      referralsApi: queryReferralsCustomers,
      introColumns: this.createIntroTableColumns(),
      repeatColumns: this.createRepeatTableColumns()
    }
  },
  computed: {
  },
  created() {
    this.init();
  },
  methods: {
    init() {

    },
    createIntroTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 60,
          render: props => {
            return (
              <div>
                <el-button size="mini" type="text" onClick={() => this.editHandle(props.row)}>
                  查看
                </el-button>
              </div>
            );
          }
        },
        {
          title: '客户名称',
          dataIndex: 'customerName'
        },
        {
          title: '手机号码',
          dataIndex: 'mobilePhone'
        },
        {
          title: '线索来源',
          dataIndex: 'clueSourceName'
        },
        {
          title: '客户类型',
          dataIndex: 'customerType',
          render: props => {
            return <span>{this.createDictText(props.row.customerType, '1523')}</span>;
          }
        },
        {
          title: '基盘状态',
          dataIndex: 'loseStatus',
          render: props => {
            return <span>{this.createDictText(props.row.loseStatus, '7051')}</span>;
          }
        },
        {
          title: '意向级别',
          dataIndex: 'intentLevel',
          render: props => {
            return <span>{this.createDictText(props.row.intentLevel, '1519')}</span>;
          }
        },
        {
          title: '是否到店',
          dataIndex: 'flowStatus',
          render: props => {
            return <span>{this.createDictText(props.row.flowStatus, '1004')}</span>;
          }
        },
        {
          title: '创建人',
          dataIndex: 'createdBy'
        },
        {
          title: '创建时间',
          dataIndex: 'createdAt',
          render: props => {
            if(props.row.createdAt&&props.row.createdAt!=''){
              return <div>{formatdate(new Date(parseInt(props.row.createdAt)), 1)}</div>;
            }
          }
        },
        {
          title: '网销顾问',
          dataIndex: 'consultant'
        },
        {
          title: '意向车系',
          dataIndex: 'intentSeriesName'
        }
      ];
    },
    createRepeatTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '客户名称',
          dataIndex: 'cusName'
        },
        {
          title: '手机号码',
          dataIndex: 'cusPhone'
        },
        {
          title: '线索状态',
          dataIndex: 'clueStatus'
        },
        {
          title: '无效原因',
          dataIndex: 'invalidReason'
        },
        {
          title: '来源大类',
          dataIndex: 'cusSource'
        },
        {
          title: '来源细分',
          dataIndex: 'cusSourceDetail'
        },
        {
          title: '线索类型',
          dataIndex: 'clueType'
        },
        {
          title: '客户类型',
          dataIndex: 'cusType'
        },
        {
          title: '是否到店',
          dataIndex: 'isArrival'
        },
        {
          title: '备注',
          dataIndex: 'note'
        },
        {
          title: '创建时间',
          dataIndex: 'createTime'
        },
        {
          title: '意向车系',
          dataIndex: 'perposeSeries'
        }
      ];
    }
  },
  mounted() {
    this.BaseTable = this.$refs.introTable.$refs.pageTable;
  }
};
</script>
